package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.mapper.BaseRolePowerMapper;
import com.kaili.basic.pojo.dto.MdmRoleAddDto;
import com.kaili.basic.pojo.dto.MdmRoleQueryDto;
import com.kaili.basic.pojo.entity.MdmRoleExport;
import com.kaili.basic.pojo.entity.MdmRoleQueryEntity;
import com.kaili.basic.pojo.vo.MdmRoleVO;
import com.kaili.basic.service.IBaseRolePowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by linjian on 19-8-5.
 */
@Service
public class BaseRolePowerServiceImpl implements IBaseRolePowerService {

    @Autowired
    private BaseRolePowerMapper baseRolePowerMapper;

    @Override
    public List<MdmRoleExport> rolesInfoExport(MdmRoleQueryDto dto) {
        return baseRolePowerMapper.rolesInfoExport(dto);
    }

    @Override
    public Page<MdmRoleVO> queryRoleByConditions(Page<MdmRoleVO> page, MdmRoleQueryDto dto) {
        List<MdmRoleVO> list = baseRolePowerMapper.queryRoleByConditions(page,dto);
        return page.setRecords(list);
    }

    @Override
    public int addRoleManager(MdmRoleVO mdmRoleVO) {
        int status = 1;
        baseRolePowerMapper.addRoleManager(mdmRoleVO);
        return status;
    }

    @Override
    public Integer getUsableCode() {
        return baseRolePowerMapper.getUsableCode();
    }

    @Override
    public void createdVersionCode(Map<String, Object> timeMap) {
        baseRolePowerMapper.createdVersionCode(timeMap);
    }

    @Override
    public void updateRoleCodeUsing(Integer id) {
        baseRolePowerMapper.updateRoleCodeUsing(id);
    }

    @Override
    public void updateRoleCodeUsed(Integer id) {
        baseRolePowerMapper.updateRoleCodeUsed(id);
    }

    @Override
    public void updateRoleCodeUnuse(Integer id) {
        baseRolePowerMapper.updateRoleCodeUnuse(id);
    }

    @Override
    public void deleteRoleById(Integer id) {
        baseRolePowerMapper.deleteRoleById(id);
    }

    @Override
    public void updateRoleById(MdmRoleVO mdmRoleVO) {
        baseRolePowerMapper.updateRoleById(mdmRoleVO);
    }

    @Override
    public MdmRoleQueryEntity queryRoleInfoById(Integer id) {
        return baseRolePowerMapper.queryRoleInfoById(id);
    }

    @Override
    public void updateRoleName(MdmRoleAddDto dto) {
        baseRolePowerMapper.updateRoleName(dto);
    }

}
